<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>轮播图</title>
  <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
  <link rel="stylesheet" href="./swiper.css">
  <style>
    body {
      height: 100%;
      margin: 20px;
      background-color: #eee;
    }
  </style>
</head>
<body>
  <!-- 卡片 -->
  <div class="layui-card">
    <!-- 标题内容 -->
    <div class="layui-card-header headerDiv">
      轮播图管理
      <button type="button" class="layui-btn layui-bg-blue header-btn" id="test1">
        <i class="layui-icon">&#xe67c;</i>上传图片
      </button>
      <input type="file" id="filebtn" style="display: none;" multiple>
    </div>
    <!-- 表格内容 -->
    <div class="layui-card-body">
      <table class="layui-table">
        <colgroup>
          <col width="150">
          <col width="200">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th>ID</th>
            <th>图片预览</th>
            <th>图片路径</th>
            <th>状态</th>
            <th>操作</th>
          </tr> 
        </thead>
        <tbody>
        </tbody>
      </table>
    </div>
  </div>

  <!-- 轮播图模板 -->
  <script type="text/html" id="tpl-content">
    {{each data val}}
    <tr>
      <td>{{val.id}}</td>
      <td>
        <img src="{{'http://localhost:8888/uploads/' + val.swiperimg}}">
      </td>
      <td>{{val.swiperimg}}</td>
      <td>
        {{if val.swiperstatus === 1}}
        <span data-id='{{val.id}}' data-status='2' class="layui-badge layui-bg-green">√</span>
        {{else}}
        <span data-id='{{val.id}}' data-status='1' class="layui-badge layui-bg-cyan">×</span>
        {{/if}}
      </td>
      <td>
        <button data-id= '{{val.id}}' type="button" class="layui-btn layui-btn-xs layui-btn-danger">删除</button>
      </td>
    </tr>
    {{/each}}
  </script>
  
  <!-- 引入script -->
  <script src="../assets/lib/jquery.js"></script>
  <script src="../assets/js/common.js"></script>
  <script src="../assets/lib/layui/layui.all.js"></script>
  <script src="../assets/lib/template-web.js"></script>
  <script src="../assets/js/swiper/swiper.js"></script>
</body>
</html>